package com.houweishi.module.bizSerialNum.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.houweishi.common.annotation.Log;
import com.houweishi.common.core.controller.BaseController;
import com.houweishi.common.core.domain.AjaxResult;
import com.houweishi.common.enums.BusinessType;
import com.houweishi.module.bizSerialNum.domain.BizSerialNumT;
import com.houweishi.module.bizSerialNum.service.IBizSerialNumTService;
import com.houweishi.common.utils.poi.ExcelUtil;
import com.houweishi.common.core.page.TableDataInfo;

/**
 * 表单流水生成表Controller
 * 
 * @author houweishi
 * @date 2023-03-09
 */
@RestController
@RequestMapping("/module/bizSerialNum")
public class BizSerialNumTController extends BaseController
{
    @Autowired
    private IBizSerialNumTService bizSerialNumTService;

    /**
     * 查询表单流水生成表列表
     */
    @PreAuthorize("@ss.hasPermi('module:bizSerialNum:list')")
    @GetMapping("/list")
    public TableDataInfo list(BizSerialNumT bizSerialNumT)
    {
        startPage();
        List<BizSerialNumT> list = bizSerialNumTService.selectBizSerialNumTList(bizSerialNumT);
        return getDataTable(list);
    }

    /**
     * 导出表单流水生成表列表
     */
    @PreAuthorize("@ss.hasPermi('module:bizSerialNum:export')")
    @Log(title = "表单流水生成表", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BizSerialNumT bizSerialNumT)
    {
        List<BizSerialNumT> list = bizSerialNumTService.selectBizSerialNumTList(bizSerialNumT);
        ExcelUtil<BizSerialNumT> util = new ExcelUtil<BizSerialNumT>(BizSerialNumT.class);
        util.exportExcel(response, list, "表单流水生成表数据");
    }

    /**
     * 获取表单流水生成表详细信息
     */
    @PreAuthorize("@ss.hasPermi('module:bizSerialNum:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(bizSerialNumTService.selectBizSerialNumTById(id));
    }

    /**
     * 新增表单流水生成表
     */
    @PreAuthorize("@ss.hasPermi('module:bizSerialNum:add')")
    @Log(title = "表单流水生成表", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BizSerialNumT bizSerialNumT)
    {
        return toAjax(bizSerialNumTService.insertBizSerialNumT(bizSerialNumT));
    }

    /**
     * 修改表单流水生成表
     */
    @PreAuthorize("@ss.hasPermi('module:bizSerialNum:edit')")
    @Log(title = "表单流水生成表", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BizSerialNumT bizSerialNumT)
    {
        return toAjax(bizSerialNumTService.updateBizSerialNumT(bizSerialNumT));
    }

    /**
     * 删除表单流水生成表
     */
    @PreAuthorize("@ss.hasPermi('module:bizSerialNum:remove')")
    @Log(title = "表单流水生成表", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(bizSerialNumTService.deleteBizSerialNumTByIds(ids));
    }


}
